home *** CD-ROM | disk | FTP | other *** search
/ Super PC 31 / Super PC 31 (Shareware).iso / spc / inter / speakf / fuente / rtp.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-10-24  |  3.2 KB  |  118 lines

  1. /*
  2. * rtp.h  --  RTP header file
  3. * RTP draft: November 1994 version
  4. *
  5. * $Id: rtp.h,v 1.3 1995/08/17 13:54:58 hgs Exp $
  6. */
  7.  
  8. typedef unsigned char u_int8;
  9. typedef unsigned short u_int16;
  10. typedef unsigned long u_int32;
  11.  
  12. #define RTP_SEQ_MOD (1<<16)
  13. #define RTP_TS_MOD    (0xffffffff)
  14. /*
  15. * Current type value.
  16. */
  17. #define RTP_VERSION 2
  18.  
  19. #define RTP_MAX_SDES 256   /* maximum text length for SDES */
  20.  
  21. typedef enum {
  22.   RTCP_SR    = 200,
  23.   RTCP_RR    = 201,
  24.   RTCP_SDES = 202,
  25.   RTCP_BYE    = 203,
  26.   RTCP_APP    = 204
  27. } rtcp_type_t;
  28.  
  29. typedef enum {
  30.   RTCP_SDES_END    =  0,
  31.   RTCP_SDES_CNAME  =  1,
  32.   RTCP_SDES_NAME   =  2,
  33.   RTCP_SDES_EMAIL  =  3,
  34.   RTCP_SDES_PHONE  =  4,
  35.   RTCP_SDES_LOC    =  5,
  36.   RTCP_SDES_TOOL   =  6,
  37.   RTCP_SDES_NOTE   =  7,
  38.   RTCP_SDES_PRIV   =  8, 
  39.   RTCP_SDES_IMG    =  9,
  40.   RTCP_SDES_DOOR   = 10,
  41.   RTCP_SDES_SOURCE = 11
  42. } rtcp_sdes_type_t;
  43.  
  44. typedef struct {
  45.   unsigned int version:2;  /* protocol version */
  46.   unsigned int p:1;        /* padding flag */
  47.   unsigned int x:1;        /* header extension flag */
  48.   unsigned int cc:4;       /* CSRC count */
  49.   unsigned int m:1;        /* marker bit */
  50.   unsigned int pt:7;       /* payload type */
  51.   u_int16 seq;               /* sequence number */
  52.   u_int32 ts;               /* timestamp */
  53.   u_int32 ssrc;            /* synchronization source */
  54.   u_int32 csrc[1];           /* optional CSRC list */
  55. } rtp_hdr_t;
  56.  
  57. typedef struct {
  58.   unsigned int version:2;  /* protocol version */
  59.   unsigned int p:1;        /* padding flag */
  60.   unsigned int count:5;    /* varies by payload type */
  61.   unsigned int pt:8;       /* payload type */
  62.   u_int16 length;           /* packet length in words, without this word */
  63. } rtcp_common_t;
  64.  
  65. /* reception report */
  66. typedef struct {
  67.   u_int32 ssrc;            /* data source being reported */
  68.   unsigned long fraction:8; /* fraction lost since last SR/RR */
  69.   long lost:24;               /* cumulative number of packets lost (signed!) */
  70.   u_int32 last_seq;        /* extended last sequence number received */
  71.   u_int32 jitter;           /* interarrival jitter */
  72.   u_int32 lsr;               /* last SR packet from this source */
  73.   u_int32 dlsr;            /* delay since last SR packet */
  74. } rtcp_rr_t;
  75.  
  76. typedef struct {
  77.   u_int8 type;               /* type of SDES item (rtcp_sdes_type_t) */
  78.   u_int8 length;           /* length of SDES item (in octets) */
  79.   char data[1];            /* text, not zero-terminated */
  80. } rtcp_sdes_item_t;
  81.  
  82. /* one RTCP packet */
  83. typedef struct {
  84.   rtcp_common_t common;    /* common header */
  85.   union {
  86.     /* sender report (SR) */
  87.     struct {
  88.       u_int32 ssrc;        /* source this RTCP packet refers to */
  89.       u_int32 ntp_sec;       /* NTP timestamp */
  90.       u_int32 ntp_frac;
  91.       u_int32 rtp_ts;       /* RTP timestamp */
  92.       u_int32 psent;       /* packets sent */
  93.       u_int32 osent;       /* octets sent */ 
  94.       /* variable-length list */
  95.       rtcp_rr_t rr[1];
  96.     } sr;
  97.  
  98.     /* reception report (RR) */
  99.     struct {
  100.       u_int32 ssrc;        /* source this generating this report */
  101.       /* variable-length list */
  102.       rtcp_rr_t rr[1];
  103.     } rr;
  104.  
  105.     /* BYE */
  106.     struct {
  107.       u_int32 src[1];       /* list of sources */
  108.       /* can't express trailing text */
  109.     } bye;
  110.  
  111.     /* source description (SDES) */
  112.     struct rtcp_sdes_t {
  113.       u_int32 src;                /* first SSRC/CSRC */
  114.       rtcp_sdes_item_t item[1]; /* list of SDES items */
  115.     } sdes;
  116.   } r;
  117. } rtcp_t;
  118.